/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By 深圳中科鑫智科技有限公司
 * Copyright authorization contact 18814114118
 */
package com.yami.shop.api.controller;

import com.yami.shop.bean.app.dto.ShopCanvasDto;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.service.IndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 画布选择商品查询
 */
@RestController
@RequestMapping("canvas")

@Tag(name = "首页画布接口")
public class CanvasController {

    @Autowired
    private IndexService indexService;

    /**
     * 读取画布数据
     * @return
     */
    @GetMapping("getCanvas")
    @Operation(summary = "画布数据" , description = "画布数据")
    @Parameters({
            @Parameter(name = "terminal", description = "类型1小程序 2H5" , required = true)
    })
    public ServerResponseEntity<ShopCanvasDto> getCanvas(Integer terminal){
        ShopCanvasDto shopCanvasDto = new ShopCanvasDto();
        shopCanvasDto.setTerminal(terminal);
        shopCanvasDto.setType(1);
        ShopCanvasDto canvas=indexService.getCanvas(shopCanvasDto);
        return ServerResponseEntity.success(canvas);
    }

}
